<template>
	<view class="content">
		<div class="top-img cl">
			<image :src="data_info.cover"></image>
		</div>
		<div class="che-content cl">
			<div class="che-detail-1 cl">
				<span>￥</span>
				<span>{{data_info.zzjfje}}</span>
				<span>7天起租</span>
				<span class="iconfont icon-wenti" @tap="tishi()"></span>
			</div>
			<div class="che-detail-2 cl">
				{{data_info.sbflmc}}
			</div>
			<div class="che-detail-3 cl">
				产品押金￥{{data_info.yajin}}
			</div>
		</div>
		<div class="che-content-details cl">
			<p>商品详情</p>
			<image :src="item.original_file_full_path" mode="widthFix" v-for="(item,index) in data_info.details" :key="index"></image>
			
			
			
		</div>
		<div class="order-sure cl">
			<div class="link-kefu cl">
				<image src="https://kehu-1256834579.cos.ap-shanghai.myqcloud.com/weier/kefu.png" mode="widthFix"></image>
				<p>联系客服</p>
			</div>
			<div class="link-xiadan" @tap="param_to_url('yuyue_sure_order?rowid='+rowId)">
				去下单
			</div>
		</div>
	</view>
</template>

<script>
	import common_config from '../../static/js/common.js';
	var config = common_config.config;
	var that;	
	var userInfo;
	export default {
		data() {
			return {
				rowId:'',
				data_info:{}
			}
		},
		onLoad(options) {
			that = this;
			that.rowId = options.rowid;
			that.plusReady();
		},
		methods: {
			//初始化
			plusReady(){
			  	userInfo = uni.getStorageSync('userInfo');
			  	if(userInfo){
			  		userInfo = JSON.parse(userInfo);
			  		that.if_login = true;
			  		that.member_profile = userInfo;
			  	}else{
			  		that.if_login = false;
			  	}
			  	that.load_datas();
			},
			tishi(){
				uni.showModal({
				  title: '长租规则',
				  content: `1、预约租赁以“周”为最小单位，不足一周按”周“计算；\n
				2、可自提，如需配送需增加配送费100元/单程；\n
				3、续租每月优惠200元。`,
				  showCancel: false
				});
			},
			load_datas(){
				console.log(121212);
				uni.request({
				  url: config.request_url+'/v2/open/worksheet/getRowByIdPost',
				  method: 'POST',
				  header: {
					'Content-Type': 'application/json'
				  },
				  data: {
					"appKey": config.appKey,
					"sign": config.sign,
					"worksheetId": "czsbfl",
					"rowId":that.rowId
				  },
				  success: (res) => {
					console.log('返回结果:', res.data);
					res = res.data;
					console.log(res);
					if(res.success){
						that.data_info = res.data;
						var r = JSON.parse(res.data.tupian);
						var details = JSON.parse(res.data.xqtp);
						that.data_info.cover = r[0].original_file_full_path;
						that.data_info.details = details;
					}else{
						 uni.showToast({ title: res.data.msg || '数据获取失败', icon: 'none' });
					}
				  },
				  fail: (err) => {
					console.error('请求失败:', err);
					uni.showToast({ title: '网络错误', icon: 'none' });
				  }
				})  
			},
			param_to_url(url){
				uni.navigateTo({
					url:url
				})
			}
		}
	}
</script>

<style>
page,.content{background-color: #f6f6f6;}
.top-img{width: 100%;height: 400rpx;text-align: center;padding-bottom: 60rpx;background-color: #E8E8E8;}
.top-img image{width: 40%;margin-top: 40rpx;height: 300rpx;}
.che-content{background-color: #fff;width: 88%;margin-left: 3%;margin-top: -80rpx;background-color: #fff;padding: 20rpx 3%;border-radius: 16rpx;}
.che-detail-1 span:nth-child(1){font-size: 24rpx;color: #FF2D2D;font-weight: bold;}
.che-detail-1 span:nth-child(2){color: #FF2D2D;font-size: 34rpx;font-weight: bold;}
.che-detail-1 span:nth-child(3){color: #777;font-size: 24rpx;margin-left: 10rpx;}
.che-detail-2{width: 100%;padding: 30rpx 0px;background-color: #e8e8e8;text-align: center;padding: 20rpx 0px;font-weight: bold;margin-top: 20rpx;}
.che-detail-3{font-size: 24rpx;color: #777;margin-top: 20rpx;}
.che-content-details{margin-top: 40rpx;width: 100%;}
.che-content-details p:nth-child(1){display: block;padding: 20rpx 3%;width: 94%;background-color: #0075b8;color: #fff;}
.che-content-details image{width: 100%;}
.order-sure{position: fixed;bottom: 0px;z-index: 100;background-color: #fff;width: 100%;padding: 0rpx 0px 0px 0px;height: auto;overflow: hidden;}
.link-kefu{float: left;width: 25%;text-align: center;padding: 10rpx 0px;}
.link-kefu image{width: 30%;}
.link-kefu p{text-align: center;font-size: 28rpx;}
.link-xiadan{float: left;width: 75%;background-color: #0075B8;color: #fff;text-align: center;font-size: 32rpx;padding: 40rpx 0px;}
.che-detail-1 .icon-wenti {
  font-size: 28rpx;
  color: #999;
  margin-left: 10rpx;
}
</style>
